import CryptoJS from 'crypto-js'

// aes加密
export const encryptAES = (data, key) => {
  const paddedKey = CryptoJS.enc.Utf8.parse(key)
  const encrypted = CryptoJS.AES.encrypt(data, paddedKey, {
    mode: CryptoJS.mode.ECB,
    padding: CryptoJS.pad.Pkcs7
  })
  return encrypted.toString()
}

// md5加密
export const hashMD5 = data => {
  return CryptoJS.MD5(data).toString()
}
